package com.ruoyi.parkinglot.controller;
import com.ruoyi.parkinglot.service.ParkAreaService;
import com.ruoyi.parkinglot.utils.Result;
import com.ruoyi.parkinglot.domain.ParkArea;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 区域信息管理Controller
 *
 * @author 31713
 * @date 2025-02-11
 */
@RestController
@RequestMapping("/parkArea")
public class ParkAreaController {

    @Resource
    private ParkAreaService parkAreaService;

    /**
     * 根据区域ID查询区域信息
     *
     * @param areaId 区域ID
     * @return 结果
     */
    @GetMapping("/park/{areaId}")
    public Result getAreaById(@PathVariable("areaId") Long areaId) {
        ParkArea area = parkAreaService.getAreaById(areaId);
        return Result.success(area);
    }
    /**
     * 获取所有区域列表
     */
    @GetMapping("/list")
    public Result list() {
        List<ParkArea> list = parkAreaService.selectParkAreaList();
        return Result.success(list);
    }
}
